package ooday02;

/**
 * 方法重写的测试
 */
public class OverrideDemo {
    public static void main(String[] args) {
        //重写方法调用时，看对象的类型执行方法(new谁就调谁)
        Student zs = new Student("张三",18,"石家庄","jsd2407","0333");
        zs.sayHi();  //调用Student重写之后的
        Teacher ll = new Teacher("李玲",45,"石家庄",8000);
        ll.sayHi();  //调用Teater重写之后的
        Doctor zl = new Doctor("赵六",30,"石家庄","主治医师");
        zl.sayHi();  //调用Person中的
    }
}
